home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000058_icon-group-sender _Mon Feb 21 06:28:54 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  3KB

  1. From: icon-group-sender
  2. Message-Id: <199402211618.AA08254@cheltenham.cs.arizona.edu>
  3. Received: by cheltenham.cs.arizona.edu; Mon, 21 Feb 1994 09:18:41 MST
  4. Subject: Re: generating both [lr]values of records
  5. To: jeffery@ringer.cs.utsa.edu (Clinton L. Jeffery)
  6. Date: Mon, 21 Feb 1994 06:28:54 -0700 (MST)
  7. Cc: icon-group
  8. In-Reply-To: <9402210630.AA27481@ringer.cs.utsa.edu.sunset> from "Clinton L. Jeffery" at Feb 21, 94 00:30:21 am
  9. X-Mailer: ELM [version 2.4 PL23]
  10. Mime-Version: 1.0
  11. Status: R
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13.  
  14. >     Peter Bigot writes about record lvalues:
  15. >     # What I'd like:
  16. >     # every !ar := (¤tgenelt)+1
  17. >     # but for some reason that doesn't work....
  18. > Peter, !r does generate assignable references to record r's fields, but its
  19. > easy to inadvertently get yourself in trouble in the surrounding expression
  20. > (the usual mistake is to try to assign each field different results from a
  21. > generator; you need a co-expression for parallel evaluation of generators).
  22.  
  23. Hmn; yeah, I suppose I could do:
  24. lval := create !ar
  25. rval := create !ar
  26. while (@lval := @rval+1)
  27.  
  28. That does what I want.  Or even:
  29. rval := create !ar
  30. every !ar := (@rval+1)
  31.  
  32. Which is getting back to the succinctness and incomprehensibility I like to
  33. have in my Icon programs.  Isn't that going to be pretty expensive in
  34. time/space too, though?  How does it compare to constructing a list of new
  35. fields and using string evaluation on the record constructor?  I suppose I
  36. could do timing tests, but I'd rather appeal to intuition (even if it isn't
  37. mine).
  38.  
  39. This is an extremely small but potentially high-frequency part of what's
  40. looking to be an ugly program that will probably be _very_ slow; but it's a
  41. research tool, what do you want? ;-)
  42.  
  43. > Anyhow, check out the following program, which assigns new values to a
  44. > record's fields (it writes out 1, 2, 3, and 4 on separate lines).
  45.  
  46. Thanks; unfortunately, that doesn't seem to show how you can use the current
  47. value of the field being assigned to construct the new value.  In the actual
  48. context, I can't reconstruct the current value from base principles.
  49.  
  50. It'd be "cool"(tm) if one could use a keyword or some other feature to
  51. get multiple references to the currently-generated element within an
  52. expression, although this probably has semantic overtones I'd rather not
  53. think about at this hour of the morning.
  54.  
  55. Peter
  56.  
  57. -- 
  58.                      Peter A. Bigot -- pab@CS.Arizona.EDU
  59.           Dept. of Computer Science, University of Arizona, Tucson AZ
  60.